<template>
  <div class="jingpinbox">
    <div class="wrap jingpin">
      <div class="jingpintitle">
        <div class="txt">
          <img src="../assets/img/jingpin.png" alt="" />
          精品推荐
        </div>
        <div>
          更多
          <img src="../assets/img/arrow.png" alt="" />
        </div>
      </div>

      <ul class="jingpinitem">
        <li v-for="item in jingpinList" :key="item.id" :data="item">
          <div class="imgbox"><img :src="bindIcon(item.coverImg)" /></div>
          <div class="jingpinbottom">
            <div class="txtbottom">{{ item.name }}</div>
            <div class="coin">
              {{ item.coin }}
              <img src="../assets/img/monad.png" alt="" />
            </div>
            <div class="exchange">立刻兑换</div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { jingpinAPI } from "@/request/api.js"; //只使用接口部分引入使用{}

export default {
  name: "ProjectPracticeBanner",
  data() {
    return {
      jingpinList: [],
    };
  },

  async created() {
    let res = await jingpinAPI();
    this.jingpinList = res.data.data.data.records;
    // console.log("res:", res);
    // console.log(res.data.data.data.records);
    // console.log(this.jingpinList);
  },
  methods: {
    bindIcon(coverImg) {
      return "http://sc.wolfcode.cn" + coverImg;
    },
  },
};
</script>

<style lang="less" scoped>
.jingpinbox {
  margin-top: 30px;
  background: #f5f5f5;
}
.jingpintitle {
  display: flex;
  justify-content: space-between;
  height: 102px;
  line-height: 102px;
  text-align: center;
  vertical-align: center;
  img {
    vertical-align: middle;
  }
  .txt {
    font-size: 30px;
    font-family: SourceHanSansSC;
    font-weight: bold;
    color: #242b39;
  }
}
.jingpinitem {
  display: flex;
  justify-content: space-between;
  border: 1px solid #f5f5d5;
  li {
    background-color: #fff;
    box-sizing: border-box;
    margin: 0 auto;
    // text-align: center;
  }
  li:hover .exchange {
    background-color: #0a328e;
    color: white;
    font-weight: 700;
  }
  .exchange {
    width: 100px;
    height: 36px;
    line-height: 36px;
    border: 1px solid #0a328e;
    color: #0a328e;
    margin-left: 88px;
  }
  .jingpinbottom {
    height: 162px;
    text-align: center;
    font-size: 18px;
    font-family: SourceHanSansSC;
    font-weight: 500;
    .coin {
      color: #fd604d;
      img {
        width: 20px;
        height: 20px;
        margin-left: 5px;
        vertical-align: middle;
      }
    }
  }
  .jingpinbottom > div {
    margin-top: 20px;
  }
}
</style>